﻿CREATE TABLE [dbo].[HospCard] (
    [CardId]       INT           IDENTITY (1, 1) NOT NULL,
    [OpenId]       NVARCHAR (50) NOT NULL,
    [CardType]     INT           NULL,
    [CardNo]       NVARCHAR (50) NOT NULL,
    [PatientName]  NVARCHAR (50) NULL,
    [CardStatus]   INT           CONSTRAINT [DF_HospCard_CardStatus] DEFAULT ((0)) NOT NULL,
    [AddDt]        DATETIME      CONSTRAINT [DF_HospCard_AddDt] DEFAULT (getdate()) NOT NULL,
    [UpdateDt]     DATETIME      NULL,
    [UpdateRemark] NTEXT         NULL,
    [DeleteStatus] INT           NULL,
    [DeleteDt]     DATETIME      NULL,
    [PatientId]    NVARCHAR (50) NULL,
    [InDeptNo]     NVARCHAR (50) NULL,
    [Name]         NVARCHAR (50) NULL,
    [Gender]       NVARCHAR (50) NULL,
    [Age]          NVARCHAR (50) NULL,
    [Birthdate]    NVARCHAR (50) NULL,
    [IdenNo]       NVARCHAR (50) NULL,
    [Phone]        NVARCHAR (50) NULL,
    [FeeType]      NVARCHAR (50) NULL,
    [IsDefault]    INT           DEFAULT ((0)) NULL,
    CONSTRAINT [PK_HospCard] PRIMARY KEY CLUSTERED ([CardId] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'就诊卡', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'就诊卡Id，自增列，主键', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'CardId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'微信用户OpenId', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'OpenId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'就诊卡类型：0诊疗卡 1健康卡 2市民卡', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'CardType';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'就诊卡号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'CardNo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者姓名', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'PatientName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'就诊卡状态：0未审核 1审核成功 2审核失败', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'CardStatus';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'添加时间', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'AddDt';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'更新时间', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'UpdateDt';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'更新备注，记录审核失败的原因', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'UpdateRemark';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'删除状态：0未删除 1已删除，默认为0，删除后的就诊卡则不显示', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'DeleteStatus';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'删除时间', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'DeleteDt';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者标识', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'PatientId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'住院号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'InDeptNo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者名称', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'Name';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者性别', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'Gender';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者年龄', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'Age';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者出生日期 yyyy-MM-dd', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'Birthdate';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者身份证号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'IdenNo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者联系电话', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'Phone';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'患者费别 自费或者公费', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'FeeType';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'是否默认就诊卡； 1-默认，0-非默认', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'HospCard', @level2type = N'COLUMN', @level2name = N'IsDefault';

